<template>
  <el-dialog
    :visible.sync="value"
    :before-close="cancel"
  >
    <template slot="title">
      佣金链模式：信用网
    </template>
    <el-table
      border
      :data="rowData.itemList"
    >
      <el-table-column label="层级" prop="level" align="center">
        <template slot-scope="{row}">
          {{row.level}}{{formatUserName(row)}}
        </template>
      </el-table-column>
      <el-table-column label="代理账号" prop="proxyName" align="center" />
      <el-table-column label="代理账号" prop="rate" align="center">
        <template slot-scope="{row}">
          {{row.rate || 0}}%
        </template>
      </el-table-column>
    </el-table>
    <div class="cash-detail-footer-view">
      最低有效会员数：{{rowData.minEffectMemberNum || 0}}
    </div>
  </el-dialog>
</template>

<script>

  export default {
    name: "audit-dialog",
    props: {
      rowData: {
        type: Object,
        required: true,
        default: {
          itemList: []
        },
      },
      value: {
        type: Boolean,
        default: true
      },
      userName: {
        type: String,
        default: '',
      },
    },
    methods: {
      formatUserName({ proxyName }) {
        if (proxyName === this.userName) return ' (本级)'
        return null
      },
      cancel() {
        this.$emit('input', false);
      },
    },

  }
</script>

<style lang="scss">

  .cash-detail-footer-view {
    margin-top: 10px;
  }

</style>
